STEPPER MOTOR INTERFACING WITH ARDUINO
In this project, we designed a simple system to control a stepper motor using Arduino (ATmega328p). We have used ATmega328p as the main controlling part of the project to control the steps of the stepper motor.
Synopsis

Stepper Motor is a type of brushless DC Motor that converts electrical pulses into distinct mechanical movements i.e. the shaft of a stepper motor rotates in discrete steps. When a computer controls these steps, we can get precise position and speed control.

Because of this discrete nature of step – wise rotation of a stepper motor, they are often employed in industrial automation, CNC systems, etc. where precision motion is required.

In this project, we designed a simple system to control a stepper motor using Arduino (ATmega328p). We have used ATmega328p as the main controlling part of the project to control the steps of the stepper motor.

Description

A stepper motor consists of two main parts, a rotor and a stator. The rotor is the part of the motor that actually spins and provides work. The stator is the stationary part of the motor that houses the rotor. In a stepper motor, the rotor is a permanent magnet. The stator consists of multiple coils that act as electromagnets when an electrical current is passed through them. The electromagnetic coil will cause the rotor to align with it when charged. The rotor is propelled by alternating which coil has a current running through it.

Stepper motors diverge from regular DC motors because rather than just spinning in one direction or another, they can spin in a very precise increments. The motor spins very fast in one direction or another. Speed of the motor can be varied with the amount of power which is given to the motor.

Stepper motors can move an exact amount of degrees when articulate to do so. This gives us a proper control over the motor, allowing us to move it to an exact location and hold that position until the next command comes to change the position. This can be done by powering coils inside the motor for very short period of time. The amendment is that we have to power the motor all the time to keep it in the position that we desire. To move a stepper motor, we tell it to move a certain number of steps in one direction or other, and tell it the speed at which to step in that specific direction.

Stepper motor fall somewhere in between servo motor and a regular DC motor. It has the advantage that you can be positioned it accurately, moved forward or backwards one ‘step’ at a time, but you can also rotate it continuously.

You can position stepper motor at any desired angle. Stepper motor has holding torque and through this property of stepper motor you can fixed or hold it’s positioned when they are not moving.

A typical stepper motor has multiple coils that are divided into phases. When each phase is energised in sequence, the rotor of the stepper motor rotates in steps.

Basically, there are three types of stepper motors: Variable Reluctance (VR) Stepper Motors, Permanent Magnet (PM) Stepper Motors and Hybrid Stepper Motors. Based on the winding of the stator, stepper motors can also be classified as

1. Bipolar

2. Unipolar

Bipolar Stepper Motor

Bipolar is robust type of stepper motor and have four leads. It has two sets of magnetic coils, and stepping is achieved by changing the direction of current through these two coils. One coil per phase is involved in bipolar motor and current flows in both directions through this coil. Bipolar will be able to produce twice as much torque compared to unipolar.


Unipolar Stepper Motor

Unipolar has also two coils but each one is center tap. These motors can step without reversing the direction of current in two coils. Because they are center tap only one half of each coil is energized at a time but they typically have less torque as compared to bipolar stepper motors. Two coils per phase are involved in unipolar motor, one for each direction of the magnetic field.


Mainly there are 3 types of stepping modes in Unipolar stepper motors.

i. Full step (One Phase on Mode, Two Phases on Mode)

i. Full step (One Phase on Mode, Two Phases on Mode)

ii. Half step

iii. Micro step

Full Step

Stepper drives control how a stepper motor operates, there are three commonly used excitation modes for stepper motors, full step, half step and microstepping. These excitation modes have an effect on both the running properties and torque the motor delivers.

A stepper motor converts electronic signals into mechanical movement each time an incoming pulse is applied to the motor. Each pulse moves the shaft in fixed increments. If the stepper motor has a 1.8° step resolution, then in order for shaft to rotate one complete revolution, in full step operation, the stepper motor would need to receive 200 pulses, 360° ÷ 1.8 = 200.

There are two types of full step excitation modes.

In one-phase on - full step, Fig1, the motor is operated with only one phase energized at a time. This mode requires the least amount of power from the driver of any of the excitation modes.

In two-phase on - full step, Fig2, the motor is operated with both phases energized at the same time. This mode provides improved torque and speed performance. Two-phase on provides about 30% to 40% more torque than one phase on, however it requires twice as much power from the driver.


Half Step

Half step excitation mode is a combination of one phase on and two phase on full step modes. This results in half the basic step angle. This smaller step angle provides smoother operation due the increased resolution of the angle.

Half step produces about 15% less torque than two phase on - full step, however modified half stepping eliminates the torque decrease by increasing the current applied to the motor when a single phase is energized.


Micro Step

Microstepping can divide a motor’s basic step by up to 256 times, making small steps smaller. A Micro drive uses two current sinewaves 90° apart, this is perfect for enabling smooth running of the motor. You will notice that the motor runs is quietly and with no real detectable stepping action.

By controlling direction and amplitude of the current flow in each winding, the resolution increases and the characteristics of the motor improve, giving less vibration and smoother operation. Because the sinewaves work together there is a smooth transition from one winding to the other. When current increases in one it decreases in the other resulting in a smooth step progression and maintained torque output.


Calculating the Steps per Revolution for Stepper Motor

It is important to know how to calculate the steps per Revolution for your stepper motor because only then you can program it effectively.

In Arduino we will be operating the motor in 4-step sequence so the stride angle will be 11.25° since it is 5.625°(given in datasheet) for 8 step sequence it will be 11.25° (5.625*2=11.25).

Steps per revolution = 360/step angle

Here, 360/11.25 = 32 steps per revolution.

Need of Driver modules for Stepper motors

Most stepper motors will operate only with the help of a driver module. This is because the controller module (In our case Arduino) will not be able to provide enough current from its I/O pins for the motor to operate. So we will use an external module like L293D module as stepper motor driver. There are a many types of driver module and the rating of one will change based on the type of motor used. The primary principle for all driver modules will be to source/sink enough current for the motor to operate.

Stepper motors have a number of benefits. They are cheap and easy to use. When there is no current send to the motor, the steppers firmly hold their position. Stepper motors can also rotate without limits and change direction based on the polarity provided.

Proteus design for Unipolar Stepper Motor interfacing with Arduino


Proteus design for Bipolar Stepper Motor interfacing with Arduino


Orcad design for Unipolar Stepper Motor interfacing with Arduino


Orcad design for Bipolar Stepper Motor interfacing with Arduino


Full Drive Unipolar Stepper Motor interfacing with Arduino

/*  Name     : main.c
 *  Purpose  : Source code for Full Step Drive Unipolar Stepper Motor 
               Interfacing with Arduino.
 *  Author   : Gemicates
 *  Date     : 08-02-2018
 *  Website  : www.gemicates.org
 *  Revision : None
 */

#include <Stepper.h> //include the function library

// set pin numbers:

// Pins 1, 2, 3, 4 connected to stepper motor through L293D

const int a1 = 1;        

const int a2 =  2;

const int b1 =  3;

const int b2 =  4;

void setup() {

// initialize the digital pins as an output

pinMode(a1, OUTPUT);

pinMode(a2, OUTPUT);

pinMode(b1, OUTPUT);

pinMode(b2, OUTPUT);

// set the pins LOW by making the voltage level LOW 

digitalWrite(a1, LOW);

digitalWrite(a2, LOW);

digitalWrite(b1, LOW);

digitalWrite(b2, LOW);

}

void loop(){

step1();

delay(200);

step2();

delay(200);

step3();

delay(200);

step4();

delay(200);

}

void step1 (){

digitalWrite(a1, HIGH);

digitalWrite(a2, HIGH);

digitalWrite(b1, LOW);

digitalWrite(b2, LOW);

}

void step2 (){

digitalWrite(a1, LOW);

digitalWrite(a2, HIGH);

digitalWrite(b1, HIGH);

digitalWrite(b2, LOW);

}

void step3 ()

{

digitalWrite(a1, HIGH);

digitalWrite(a2, LOW);

digitalWrite(b1, LOW);

digitalWrite(b2, HIGH);

}

void step4 (){

digitalWrite(a1, LOW);

digitalWrite(a2, LOW);

digitalWrite(b1, HIGH);

digitalWrite(b2, HIGH);

}
Half drive Unipolar Stepper Motor interfacing with Arduino

/*  Name     : main.c
 *  Purpose  : Source code for Half Drive Unipolar Stepper Motor 
               Interfacing with Arduino.
 *  Author   : Gemicates
 *  Date     : 08-02-2018
 *  Website  : www.gemicates.org
 *  Revision : None
 */

#include <Stepper.h> //include the function library

// set pin numbers:

// Pins 1, 2, 3, 4 connected to stepper motor through L293D

const int a1 = 1;        

const int a2 =  2;

const int b1 =  3;

const int b2 =  4;

void setup() {

// initialize the digital pins as an output

pinMode(a1, OUTPUT);

pinMode(a2, OUTPUT);

pinMode(b1, OUTPUT);

pinMode(b2, OUTPUT);

// set the pins LOW by making the voltage level LOW 

digitalWrite(a1, LOW);

digitalWrite(a2, LOW);

digitalWrite(b1, LOW);

digitalWrite(b2, LOW);

}

void loop(){

step1();

delay(60);

step2();

delay(60);

step3();

delay(60);

step4();

delay(60);

step5();

delay(60);

step6();

delay(60);

step7();

delay(60);

step8();

delay(60);

}

void step1 (){

digitalWrite(a1, HIGH);

digitalWrite(a2, LOW);

digitalWrite(b1, LOW);

digitalWrite(b2, HIGH);

}

void step2 (){

digitalWrite(a1, HIGH);

digitalWrite(a2, LOW);

digitalWrite(b1, LOW);

digitalWrite(b2, LOW);

}

void step3 ()

{

digitalWrite(a1, HIGH);

digitalWrite(a2, HIGH);

digitalWrite(b1, LOW);

digitalWrite(b2, LOW);

}

void step4 (){

digitalWrite(a1, LOW);

digitalWrite(a2, HIGH);

digitalWrite(b1, LOW);

digitalWrite(b2, LOW);

}

void step5 (){

digitalWrite(a1, LOW);

digitalWrite(a2, HIGH);

digitalWrite(b1, HIGH);

digitalWrite(b2, LOW);

}

void step6 (){

digitalWrite(a1, LOW);

digitalWrite(a2, LOW);

digitalWrite(b1, HIGH);

digitalWrite(b2, LOW);

}

void step7 (){

digitalWrite(a1, LOW);

digitalWrite(a2, LOW);

digitalWrite(b1, HIGH);

digitalWrite(b2, HIGH);

}

void step8 (){

digitalWrite(a1, LOW);

digitalWrite(a2, LOW);

digitalWrite(b1, LOW);

digitalWrite(b2, HIGH);

}
Wave drive Unipolar Stepper Motor interfacing with Arduino

/*  Name     : main.c
 *  Purpose  : Source code for Wave Drive Unipolar Stepper Motor 
               Interfacing with Arduino.
 *  Author   : Gemicates
 *  Date     : 08-02-2018
 *  Website  : www.gemicates.org
 *  Revision : None
 */

#include <Stepper.h> //include the function library

// set pin numbers:

// Pins 1, 2, 3, 4 connected to stepper motor through L293D

const int a1 = 1;        

const int a2 =  2;

const int b1 =  3;

const int b2 =  4;

void setup() {

// initialize the digital pins as an output

pinMode(a1, OUTPUT);

pinMode(a2, OUTPUT);

pinMode(b1, OUTPUT);

pinMode(b2, OUTPUT);

// set the pins LOW by making the voltage level LOW 

digitalWrite(a1, LOW);

digitalWrite(a2, LOW);

digitalWrite(b1, LOW);

digitalWrite(b2, LOW);

}

void loop(){

step1();

delay(200);

step2();

delay(200);

step3();

delay(200);

step4();

delay(200);

}

void step1 (){

digitalWrite(a1, HIGH);

digitalWrite(a2, LOW);

digitalWrite(b1, LOW);

digitalWrite(b2, LOW);

}

void step2 (){

digitalWrite(a1, LOW);

digitalWrite(a2, LOW);

digitalWrite(b1, HIGH);

digitalWrite(b2, LOW);

}

void step3 ()

{

digitalWrite(a1, LOW);

digitalWrite(a2, HIGH);

digitalWrite(b1, LOW);

digitalWrite(b2, LOW);

}

void step4 (){

digitalWrite(a1, LOW);

digitalWrite(a2, LOW);

digitalWrite(b1, LOW);

digitalWrite(b2, HIGH);

}
Bipolar Stepper Motor interfacing with Arduino

/*  Name     : main.c
 *  Purpose  : Source code for Bipolar Stepper Motor 
               Interfacing with Arduino.
 *  Author   : Gemicates
 *  Date     : 08-02-2018
 *  Website  : www.gemicates.org
 *  Revision : None
 */

#include <Stepper.h> //include the function library

// set pin numbers:

// Pins 1, 2, 3, 4 connected to stepper motor through L293D

const int a1 = 1;        

const int a2 =  2;

const int b1 =  3;

const int b2 =  4;

void setup() {

// initialize the digital pins as an output

pinMode(a1, OUTPUT);

pinMode(a2, OUTPUT);

pinMode(b1, OUTPUT);

pinMode(b2, OUTPUT);

// set the pins LOW by making the voltage level LOW 

digitalWrite(a1, LOW);

digitalWrite(a2, LOW);

digitalWrite(b1, LOW);

digitalWrite(b2, LOW);

}

void loop(){

step1();

delay(60);

step2();

delay(60);

step3();

delay(60);

step4();

delay(60);

}

void step1 (){

digitalWrite(a1, LOW);

digitalWrite(a2, LOW);

digitalWrite(b1, LOW);

digitalWrite(b2, HIGH);

}

void step2 (){

digitalWrite(a1, LOW);

digitalWrite(a2, HIGH);

digitalWrite(b1, LOW);

digitalWrite(b2, LOW);

}

void step3 ()

{

digitalWrite(a1, LOW);

digitalWrite(a2, LOW);

digitalWrite(b1, HIGH);

digitalWrite(b2, LOW);

}

void step4 (){

digitalWrite(a1, HIGH);

digitalWrite(a2, LOW);

digitalWrite(b1, LOW);

digitalWrite(b2, LOW);

}


Error message here!

Show Error message here!


Forgot your password?

Error message here!

Send OTP

Error message here!

Show Error message here!


Lost your password? Please enter your email address. You will receive a password you Need.

Send Error message here!


Back to log-in

Close